/*   1:    */ package org.intellij.images.options.impl;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.JDOMExternalizer;
import org.intellij.images.options.GridOptions;
import org.jdom.Element;

import java.awt.*;
import java.beans.PropertyChangeSupport;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */ 
/*  10:    */ final class GridOptionsImpl
/*  11:    */   implements GridOptions, JDOMExternalizable
/*  12:    */ {
/*  13:    */   private boolean a;
/*  14: 33 */   private int b = 3;
/*  15: 34 */   private int c = 1;
/*  16: 35 */   private Color d = DEFAULT_LINE_COLOR;
/*  17:    */   private final PropertyChangeSupport e;
/*  18:    */   
/*  19:    */   GridOptionsImpl(PropertyChangeSupport paramPropertyChangeSupport)
/*  20:    */   {
/*  21: 39 */     this.e = paramPropertyChangeSupport;
/*  22:    */   }
/*  23:    */   
/*  24:    */   public boolean isShowDefault()
/*  25:    */   {
/*  26: 43 */     return this.a;
/*  27:    */   }
/*  28:    */   
/*  29:    */   public int getLineZoomFactor()
/*  30:    */   {
/*  31: 47 */     return this.b;
/*  32:    */   }
/*  33:    */   
/*  34:    */   public int getLineSpan()
/*  35:    */   {
/*  36: 51 */     return this.c;
/*  37:    */   }
/*  38:    */   
/*  39:    */   public Color getLineColor()
/*  40:    */   {
/*  41: 55 */     return this.d;
/*  42:    */   }
/*  43:    */   
/*  44:    */   void setShowDefault(boolean paramBoolean)
/*  45:    */   {
/*  46: 59 */     boolean bool = this.a;
/*  47: 60 */     if (bool != paramBoolean)
/*  48:    */     {
/*  49: 61 */       this.a = paramBoolean;
/*  50: 62 */       this.e.firePropertyChange("Editor.Grid.showDefault", bool, this.a);
/*  51:    */     }
/*  52:    */   }
/*  53:    */   
/*  54:    */   void setLineMinZoomFactor(int paramInt)
/*  55:    */   {
/*  56: 67 */     int i = this.b;
/*  57: 68 */     if (i != paramInt)
/*  58:    */     {
/*  59: 69 */       this.b = paramInt;
/*  60: 70 */       this.e.firePropertyChange("Editor.Grid.lineZoomFactor", i, this.b);
/*  61:    */     }
/*  62:    */   }
/*  63:    */   
/*  64:    */   void setLineSpan(int paramInt)
/*  65:    */   {
/*  66: 75 */     int i = this.c;
/*  67: 76 */     if (i != paramInt)
/*  68:    */     {
/*  69: 77 */       this.c = paramInt;
/*  70: 78 */       this.e.firePropertyChange("Editor.Grid.lineSpan", i, this.c);
/*  71:    */     }
/*  72:    */   }
/*  73:    */   
/*  74:    */   void setLineColor(Color paramColor)
/*  75:    */   {
/*  76: 83 */     Color localColor = this.d;
/*  77: 84 */     if (paramColor == null) {
/*  78: 85 */       this.d = DEFAULT_LINE_COLOR;
/*  79:    */     }
/*  80: 87 */     if (!localColor.equals(paramColor))
/*  81:    */     {
/*  82: 88 */       this.d = paramColor;
/*  83: 89 */       this.e.firePropertyChange("Editor.Grid.lineColor", localColor, this.d);
/*  84:    */     }
/*  85:    */   }
/*  86:    */   
/*  87:    */   public void inject(GridOptions paramGridOptions)
/*  88:    */   {
/*  89: 94 */     setShowDefault(paramGridOptions.isShowDefault());
/*  90: 95 */     setLineMinZoomFactor(paramGridOptions.getLineZoomFactor());
/*  91: 96 */     setLineSpan(paramGridOptions.getLineSpan());
/*  92: 97 */     setLineColor(paramGridOptions.getLineColor());
/*  93:    */   }
/*  94:    */   
/*  95:    */   public boolean setOption(String paramString, Object paramObject)
/*  96:    */   {
/*  97:101 */     if ("Editor.Grid.showDefault".equals(paramString)) {
/*  98:102 */       setShowDefault(((Boolean)paramObject).booleanValue());
/*  99:103 */     } else if ("Editor.Grid.lineZoomFactor".equals(paramString)) {
/* 100:104 */       setLineMinZoomFactor(((Integer)paramObject).intValue());
/* 101:105 */     } else if ("Editor.Grid.lineSpan".equals(paramString)) {
/* 102:106 */       setLineSpan(((Integer)paramObject).intValue());
/* 103:107 */     } else if ("Editor.Grid.lineColor".equals(paramString)) {
/* 104:108 */       setLineColor((Color)paramObject);
/* 105:    */     } else {
/* 106:110 */       return false;
/* 107:    */     }
/* 108:112 */     return true;
/* 109:    */   }
/* 110:    */   
/* 111:    */   public void readExternal(Element paramElement)
/* 112:    */   {
/* 113:116 */     this.a = JDOMExternalizer.readBoolean(paramElement, "Editor.Grid.showDefault");
/* 114:117 */     this.b = JDOMExternalizer.readInteger(paramElement, "Editor.Grid.lineZoomFactor", 3);
/* 115:118 */     this.c = JDOMExternalizer.readInteger(paramElement, "Editor.Grid.lineSpan", 1);
/* 116:119 */     this.d = JDOMExternalizerEx.readColor(paramElement, "Editor.Grid.lineColor", DEFAULT_LINE_COLOR);
/* 117:    */   }
/* 118:    */   
/* 119:    */   public void writeExternal(Element paramElement)
/* 120:    */   {
/* 121:123 */     JDOMExternalizer.write(paramElement, "Editor.Grid.showDefault", this.a);
/* 122:124 */     JDOMExternalizer.write(paramElement, "Editor.Grid.lineZoomFactor", this.b);
/* 123:125 */     JDOMExternalizer.write(paramElement, "Editor.Grid.lineSpan", this.c);
/* 124:126 */     JDOMExternalizerEx.write(paramElement, "Editor.Grid.lineColor", this.d);
/* 125:    */   }
/* 126:    */   
/* 127:    */   public boolean equals(Object paramObject)
/* 128:    */   {
/* 129:130 */     if (this == paramObject) {
/* 130:131 */       return true;
/* 131:    */     }
/* 132:133 */     if (!(paramObject instanceof GridOptions)) {
/* 133:134 */       return false;
/* 134:    */     }
/* 135:137 */     GridOptions localGridOptions = (GridOptions)paramObject;
/* 136:138 */     return localGridOptions.getLineColor() == null ? true : (this.b == localGridOptions.getLineZoomFactor()) && (this.c == localGridOptions.getLineSpan()) && (this.a == localGridOptions.isShowDefault()) && (this.d != null) ? this.d.equals(localGridOptions.getLineColor()) : false;
/* 137:    */   }
/* 138:    */   
/* 139:    */   public int hashCode()
/* 140:    */   {
/* 141:146 */     int i = this.a ? 1 : 0;
/* 142:147 */     i = 29 * i + this.b;
/* 143:148 */     i = 29 * i + this.c;
/* 144:149 */     i = 29 * i + (this.d != null ? this.d.hashCode() : 0);
/* 145:150 */     return i;
/* 146:    */   }
/* 147:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.images.options.impl.GridOptionsImpl

 * JD-Core Version:    0.7.0.1

 */